﻿using AutoMapper;
using Enferno.Public.Web.Mappers.Resolvers;
using Enferno.Public.Web.Models;
using Enferno.Public.Web.ViewModels;
using Enferno.StormApiClient.Products;

namespace Enferno.Public.Web.Mappers.ProductProfiles
{
    public class ParametricModelToParametricViewModelProfile :
        ParametricBaseModelToParametricBaseViewModelProfile
            <ParametricModel, ParametricValueModel, ParametricViewModel, ParametricValueViewModel>
    {
        
    }


    public class ParametricBaseModelToParametricBaseViewModelProfile<TParametricModel, TParametricValueModel, TParametricViewModel, TParametricValueViewModel> : Profile
        where TParametricModel: ParametricBaseModel<TParametricValueModel>
        where TParametricValueModel: ParametricValueModel
        where TParametricViewModel: ParametricBaseViewModel<TParametricValueViewModel>
        where TParametricValueViewModel: ParametricValueViewModel
    {
        protected override void Configure()
        {
            Mapper.CreateMap<TParametricModel, TParametricViewModel>()
                .ForMember(to => to.UnitOfMeasurement, opts => opts.MapFrom(from => from.Uom));
        }

        public override string ProfileName
        {
            get { return GetType().Name; }
        }
    }
}
